import axios from 'axios'
import { getToken } from '@/utils/auth'
import qs from "qs";

export default function requestExportExcel(options = {}) {
  return new Promise((resolve, reject) => {
    axios({
      method: 'get',
      url: options.url, // 请求地址
      params: options.params, // 参数
      responseType: 'blob', // 表明返回服务器返回的数据类型
      headers: {
          'Content-Type': 'application/x-www-form-urlencoded',
          'Authorization': getToken(),
          'Access-Control-Allow-Origin':'*'
      },
      timeout:60000
    }).then(
      response => {
        // document.body.removeChild(link) // 释放标签
        resolve(response)
      },
      err => {
        reject(err)
      }
    )
  })
}
